package com.gjm.tool.controller;

import com.alibaba.fastjson.JSON;
import com.gjm.tool.modifyLog.annotaton.ModifyLog;
import com.gjm.tool.modifyLog.domain.ModifyHistoryLog;
import com.gjm.tool.paramHandle.ParamHandle;
import com.gjm.tool.sign.Sign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @Author: gjm
 * @date 2024/7/11 11:23
 * @Version 1.0
 */
@RestController
public class TestController {
    @Autowired
    private JavaMailSender mailSender;

    @PostMapping(value = "/sign/test")
    @ParamHandle(paramNames = {"paramList"})
    public void testSign(@RequestBody ModifyHistoryLog log){
        System.out.println(JSON.toJSONString(log));

    }

    @PostMapping(value = "/mail/test")
    public void testMail(){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("15652957971@163.com");
        message.setTo("gejm@hfvast.com");
        message.setSubject("测试邮件");
        message.setText("邮件测试");
        mailSender.send(message);
    }
}
